package BookTest;

public class B2PurchaseMovieTickets {
    private String name;
    private int age;

    public B2PurchaseMovieTickets() {}
    public B2PurchaseMovieTickets(String name, int age) {
        this.name=name;
        this.age=age;
    }

    public void setName(String name){
        this.name=name;
    }
    public String getName(){
        return name;
    }
    public void setAge(){
        this.age=age;
    }
    public int getAge(){
        return age;
    }
    public void getTicket(){
        int price = 40;

        if (this.age < 0) {
            System.out.println("年龄输入错误请重新输入");
        }else{
            if(this.age>=18){
                System.out.println(this.name+"      "+this.age+"        "+price);
            }else {
                System.out.println(this.name+"      "+this.age+"        "+(price/2));
            }
        }
    }
}
